from generator import getMap
import alg

class Test:
    def __init__(self ,nums , row_list , column_list):
        self.mapNums = nums           #生成的地下城地图数
        self.rowList = row_list       #地图行数
        self.columnList = column_list #地图列数
        self.maps = []
        self.minHp = []
        for i in range(self.mapNums): #构建地图列表
            map_temp = getMap(self.rowList[i] , self.columnList[i])
            self.maps.append(map_temp)
            #为每张地图构建 MinHp 类对象，求得每张地图所需要的 初始最低健康点数
            test0 = alg.MinHP(map_temp)
            temp_minHp = test0.calculateMinimumHP()
            self.minHp.append(temp_minHp)

    def outPut(self):
        print("开始运算！")
        for i in range(self.mapNums):
            print()
            print("地图为:")
            temp = self.maps[i]
            for j in range(len(temp)):  #逐行打印地图
                print(temp[j])
            print("所需最低初始健康点数:{0},求得此结果所用时间:{1}".format(self.minHp[i][0] , self.minHp[i][1]))

if __name__ == "__main__":
    test1 = Test(3 , [4,5,6] , [5,6,7])
    test1.outPut()
